<?php
/**
 * DBShop 电子商务系统
 *
 * ==========================================================================
 * @link      http://www.dbshop.net/
 * @copyright Copyright (c) 2012-2015 DBShop.net Inc. (http://www.dbshop.net)
 * @license   http://www.dbshop.net/license.html License
 * ==========================================================================
 *
 * @author    zxq
 *
 */

namespace Paper\Controller;

use Admin\Controller\BaseController;
use Zend\View\Model\ViewModel;

class PaperController extends BaseController
{

    public function indexAction()
    {
       // print_r("a");die();
        $array = array();
        //发货列表
        //获取前段的值（price）
//        $price == $this->params('price',3);
        $page = $this->params('page',1);

//        $array['ship_list'] = $this->getDbshopTable('PaperTable')->listDeliveryAddress(array('page'=>$page, 'page_num'=>20), array('price>=1'), array('id DESC'));
        //print_r($array);die();
        $array['page']= $page;

        return $array;
    }
	 /** 
     * Paper
     * @return multitype:
     */
    public function paperAction()
    {
		
        $array = array();
        //发货列表
		//获取前段的值（price）
		$price == $this->params('price',3);
        $page = $this->params('page',1);
		
        $array['ship_list'] = $this->getDbshopTable('PaperTable')->listDeliveryAddress(array('page'=>$page, 'page_num'=>20), array('price>=1'), array('id DESC'));
        //print_r($array);die();
		$array['page']= $page;
		
        return $array;
    }
    /**
     * Paper添加
     */
    public function addAction ()
    {
		
		
		 if($this->request->isPost()) {
			// print_r("a");die();
		 $userArray = $this->request->getPost()->toArray();
		// print_r($userArray);die();
		 $userId = $this->getDbshopTable('PaperTable')->addPaper($userArray);
		 }

        return $array;
    }
	 public function edit1Action ()
    {
		$array['page'] = (int) $this->params('page', 1);
        $orderId       = (int) $this->params('id');
		 $array = array();
        $array['query']= $this->request->getQuery()->toArray();
		 $array['order_info'] = $this->getDbshopTable('PaperTable')->infoOrder(array('id'=>$orderId));
		//print($array);die();
		
        //用于返回对应的分页数
		 return $array;
	}

    /**
     * 数据表调用
     * @param string $tableName
     * @return multitype:
     */
    private function getDbshopTable ($tableName='PaperTable')
    {
        if (empty($this->dbTables[$tableName])) {
            $this->dbTables[$tableName] = $this->getServiceLocator()->get($tableName);
        }
        return $this->dbTables[$tableName];
    }
	 
}
